package com.epoint.excleutil.Vo;


import com.epoint.excleutil.service.IExcelExportStyler;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.BuiltinFormats;
import org.apache.poi.ss.usermodel.CellStyle;
/**
 * Created by Shinelon on 2017/11/15.
 */
public abstract class AbstractExcelExportStyler implements IExcelExportStyler {
    protected CellStyle stringNoneStyle;
    protected CellStyle stringNoneWrapStyle;
    protected CellStyle stringSeptailStyle;
    protected CellStyle stringSeptailWrapStyle;
    protected Workbook workbook;
    protected static final short STRING_FORMAT = (short)BuiltinFormats.getBuiltinFormat("TEXT");

    protected void createStyles(Workbook workbook) {
        this.stringNoneStyle = stringNoneStyle(workbook, false);
        this.stringNoneWrapStyle = stringNoneStyle(workbook, true);
        this.stringSeptailStyle = stringSeptailStyle(workbook, false);
        this.stringSeptailWrapStyle = stringSeptailStyle(workbook, true);
        this.workbook = workbook;
    }

    public CellStyle getStyles(boolean noneStyler, ExcelExportEntity entity)
    {
        if ((noneStyler) && (((entity == null) || (entity.isWrap())))) {
            return this.stringNoneWrapStyle;
        }
        if (noneStyler) {
            return this.stringNoneStyle;
        }
        if ((!noneStyler) && (((entity == null) || (entity.isWrap())))) {
            return this.stringSeptailWrapStyle;
        }
        return this.stringSeptailStyle;
    }

    public CellStyle stringNoneStyle(Workbook workbook, boolean isWarp) {
        return null;
    }

    public CellStyle stringSeptailStyle(Workbook workbook, boolean isWarp) {
        return null;
    }

    public CellStyle getTemplateStyles(boolean isSingle, ExcelForEachParams excelForEachParams)
    {
        return null;
    }
}
